﻿<Window x:Class="KegManager.BeerWindow"
        xmlns:my="clr-namespace:KegManager"
        xmlns:kd="clr-namespace:KegData;assembly=KegData"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="BeerWindow" Height="349" Width="508" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
    <Window.Resources>
        <my:PathLabelConverter x:Key="PathLabelConverter" />
        <my:TemperatureConverter x:Key="TemperatureConverter" />
        <my:SmallVolumeConverter x:Key="SmallVolumeConverter" />
        <my:LargeVolumeConverter x:Key="LargeVolumeConverter" />
        <ObjectDataProvider MethodName="GetValues"
                            ObjectType="{x:Type sys:Enum}"
                            x:Key="BeerColorValues">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="kd:BeerColor" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="75"/>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="100"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right">Name:</Label>
        <TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"  Margin="2,2,2,2" Text="{Binding Path=beer.Name, Mode=TwoWay}"></TextBox>

        <Label Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right">Description:</Label>
        <TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="2,2,2,2" Text="{Binding Path=beer.Description, Mode=TwoWay}" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"></TextBox>

        <GroupBox Grid.Row="0" Grid.Column="3" Grid.RowSpan="3" BorderThickness="2,2,2,2" Margin="2,2,2,2" Header="Label">
            <StackPanel>
                <Button Name="buttonBrowseLabel" Margin="3,3,3,3" Click="buttonBrowseLabel_Click">Browse Label...</Button>
                <Image Name="beerLabel" Height="100" Width="100" Source="{Binding Path=beer.Label, Converter={StaticResource PathLabelConverter}}" />
            </StackPanel>
        </GroupBox>

        <Label Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right">OG:</Label>
        <TextBox Grid.Row="2" Grid.Column="1" Margin="2,2,2,2" Text="{Binding Path=beer.Gravity, Mode=TwoWay}"></TextBox>

        <Label Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right">ABV:</Label>
        <TextBox Grid.Row="3" Grid.Column="1" Margin="2,2,2,2" Text="{Binding Path=beer.Alcohol, Mode=TwoWay}"></TextBox>
        <Label Grid.Row="3" Grid.Column="2">%</Label>

        <Label Grid.Row="4" Grid.Column="0" HorizontalAlignment="Right">Bitterness:</Label>
        <TextBox Grid.Row="4" Grid.Column="1" Margin="2,2,2,2" Text="{Binding Path=beer.Bitterness, Mode=TwoWay}"></TextBox>
        <Label Grid.Row="4" Grid.Column="2">ibu</Label>

        <Label Grid.Row="5" Grid.Column="0" HorizontalAlignment="Right">Color:</Label>
        <ComboBox Grid.Row="5" Grid.Column="1" Margin="2" Name="comboBox1" SelectedValue="{Binding Path=beer.Color, Mode=TwoWay}" ItemsSource="{Binding Source={StaticResource BeerColorValues}}" />
        
        <Label Grid.Row="6" Grid.Column="0" HorizontalAlignment="Right">Rating:</Label>
        <Slider Grid.Row="6" Grid.Column="1" Margin="2,2,2,2" Minimum="1" Maximum="5" VerticalAlignment="Center" VerticalContentAlignment="Center" TickPlacement="TopLeft" Value="{Binding Path=beer.Rating, Mode=TwoWay}" ValueChanged="Slider_ValueChanged" IsSnapToTickEnabled="True" />
        <TextBlock Grid.Row="6" Grid.Column="2" Name="RatingText" />

        <Button Grid.Row="7" Grid.Column="2" Name="buttonCancel"  Margin="2,0" Click="buttonCancel_Click">Cancel</Button>
        <Button Grid.Row="7" Grid.Column="3" Name="buttonSave" Margin="2,0" Click="buttonSave_Click">Save</Button>
    </Grid>
</Window>
